
function extend(sub, sup) {
	sub.prototype = Object.create(sup.prototype);
	Object.defineProperty(sub.prototype, "constructor", {
		value: sub,
		enumerable: false
	});
}
var  Request = {
	ajax () {
		console.log("请求后台");
	}
}

var  Address =  {
	getAddress() {
		console.log("获取收货地址");
	}
}

var  Credit   = {
	total() {
		console.log("积分统计");
	}
}

function User(name, age) {
	this.name = name;
	this.age = age;
}
User.prototype.show = function() {
	console.log(this.name, this.age);
};

function Admin(name, age) {
	User.call(this, name, age);
}
extend(Admin, User);
Admin.prototype = Object.assign(Admin.prototype, Request, Credit)

let admin = new Admin("向军", 19);
admin.show();
admin.ajax();
admin.total();

function Member(name, age) {
	User.call(this, name, age);
}
extend(Member, User);
Member.prototype = Object.assign(Member.prototype, Request, Credit)
console.log('-----------------------\n')

let lisi = new Member("李四", 22);
lisi.ajax()
console.log(admin)
console.log(lisi)
